<!-- 输出当前日期 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var today = new Date();
        // 获取年月日
        var year = today.getFullYear();
        var month = today.getMonth() + 1;
        var date = today.getDate();
        var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][today.getDay()];
        var strDate = year + "年" + month + "月" + date + "日 " + weekday;
        console.log(strDate);
        //输出当前时间
        var now = new Date();
        var hour = now.getHours();
        var minute = now.getMinutes();
            var second = now.getSeconds();
        var strTime = hour + ":" + minute + ":" + second;
        console.log(strTime);
    </script>
</body>
</html>